package com.primus.server.utils;

/**
 * 进制转换工具类
 */
public class HexConversionUtils {

    /**
     * @param num 十进制数
     * @return 二十六进制字符串
     */
    public static String to26Hex(int num) {
        int n = Math.abs(num);
        StringBuilder sb = new StringBuilder();
        boolean flg = true;
        while (flg) {
            sb.insert(0, ((char) (n % 26 + 65)));
            n = n / 26;
            if (n == 0) {
                flg = false;
            }
        }
        return sb.toString();
    }
}
